package org.gw.ylc.base.repositories;

import org.gw.ylc.base.model.Major;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface MajorRepository extends CrudRepository<Major, String> {
	@Query("select m from Major m,GradeMajor g where g.major=m and (g.department.id=?1 or ?1 is null) order by m.order asc")
	public List<Major> findByDepartment(String department);
}
